using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


namespace SIS.BLL
{

    /// <summary>
    /// The StudentOtherSkillTableManager class is responsible for managing BO.StudentOtherSkillTable objects in the system.
    /// </summary>
    [DataObjectAttribute()]
    public class StudentOtherSkillTableManager
    {

        #region "Public Methods"

        /// <summary>
        /// Gets a list with all StudentOtherSkillTable objects in the database.
        /// </summary>
        /// <returns>A list with all StudentOtherSkillTable from the database when the database contains any, or null otherwise.</returns>
        [DataObjectMethod(DataObjectMethodType.Select, true)]
        public static StudentOtherSkillTableList GetList(int UserAccountKey)
        {
            return StudentOtherSkillTableDB.GetList(UserAccountKey);
        }

        /// <summary>
        /// Gets a single StudentOtherSkillTable from the database without its data.
        /// </summary>
        /// <param name="userAccountKey">The UserAccountKey of the StudentOtherSkillTable in the database.</param>
        /// <returns>A StudentOtherSkillTable object when the UserAccountKey exists in the database, or <see langword="null"/> otherwise.</returns>
        [DataObjectMethod(DataObjectMethodType.Select, false)]
        public static StudentOtherSkillTable GetItem(int SOSKey, int userAccountKey)
        {
            return GetItem(SOSKey, userAccountKey, false);
        }

        /// <summary>
        /// Gets a single StudentOtherSkillTable from the database.
        /// </summary>
        /// <param name="userAccountKey">The UserAccountKey of the StudentOtherSkillTable in the database.</param>
        /// <param name="getStudentOtherSkillTableRecords">Determines whether to load all associated StudentOtherSkillTable records as well.</param>
        /// <returns>
        /// A StudentOtherSkillTable object when the UserAccountKey exists in the database, or <see langword="null"/> otherwise.
        /// </returns>
        [DataObjectMethod(DataObjectMethodType.Select, false)]
        public static StudentOtherSkillTable GetItem(int SOSKey, int userAccountKey, bool getStudentOtherSkillTableRecords)
        {
            StudentOtherSkillTable myStudentOtherSkillTable = StudentOtherSkillTableDB.GetItem(SOSKey, userAccountKey);
            return myStudentOtherSkillTable;
        }

        /// <summary>
        /// Saves a StudentOtherSkillTable in the database.
        /// </summary>
        /// <param name="myStudentOtherSkillTable">The StudentOtherSkillTable instance to save.</param>
        /// <returns>The new UserAccountKey if the StudentOtherSkillTable is new in the database or the existing UserAccountKey when an item was updated.</returns>
        [DataObjectMethod(DataObjectMethodType.Update, true)]
        public static int Save(StudentOtherSkillTable myStudentOtherSkillTable)
        {
            using (TransactionScope myTransactionScope = new TransactionScope())
            {
                int studentOtherSkillTableUserAccountKey = StudentOtherSkillTableDB.Save(myStudentOtherSkillTable);

                //  Assign the StudentOtherSkillTable its new (or existing UserAccountKey).
                myStudentOtherSkillTable.UserAccountKey = studentOtherSkillTableUserAccountKey;

                myTransactionScope.Complete();

                return studentOtherSkillTableUserAccountKey;
            }
        }

        /// <summary>
        /// Deletes a StudentOtherSkillTable from the database.
        /// </summary>
        /// <param name="myStudentOtherSkillTable">The StudentOtherSkillTable instance to delete.</param>
        /// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
        [DataObjectMethod(DataObjectMethodType.Delete, true)]
        public static bool Delete(StudentOtherSkillTable myStudentOtherSkillTable)
        {
            return StudentOtherSkillTableDB.Delete(myStudentOtherSkillTable.UserAccountKey);
        }

        #endregion

    }

}
